package com.work7;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student implements Comparable<Student>{
    private int age;
    private String name;

    @Override
    public int compareTo(Student o) {
        if(o.age - this.age == 0) {
            return o.name.compareTo(this.name);
        }
        return o.age - this.age;
    }
}
